#include "Point.h"
#include <iostream>
using namespace std;

Point::Point(int x, int y)
	:x(x),
	y(y)
{
}
void Point::display() const
{
	cout << "(" << x << ", " << y << ")" << endl;
}

const Point operator + (const Point& lhs, const Point& rhs)
{
	int x = lhs.getX() + rhs.getX();
	int y = lhs.getY() + rhs.getY();
	return Point(x, y);
}

const Point& Point::operator ++ ()
{
	this->x++;			//this->x = this->x + 1;  this->x += 1;
	this->y++;
	return *this;
}

const Point Point::operator++(int)
{
	//备份没有改变之前的对象
	Point tmp  = *this;
	//改变当前对象
	this->x++;
	this->y++;
	//返回没有改变之前的对象值
	return tmp;
}

ostream& operator << (ostream& out, const Point& rhs)
{
	out << "(" << rhs.x << ", " << rhs.y << ")";
	return out;
}
